﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace MM.Common.Message
{
    public class ClientInfo
    {
        // Fields
        private string clientDept;
        public ArrayList ClientFunction;
        private string clientGroup;
        private int clientID;
        private string clientIP;
        private int clientMessageID;
        private string clientName;
        private string clientRole;
        private string systemCode;

        // Methods
        public ClientInfo()
        {
            this.SetNull();
        }

        public override bool Equals(object obj)
        {
            return (this.ClientMessageID == ((ClientInfo)obj).ClientMessageID);
        }

        public override int GetHashCode()
        {
            return this.ToString().GetHashCode();
        }

        public static bool operator ==(ClientInfo left, ClientInfo right)
        {
            return left.Equals(right);
        }

        public static bool operator !=(ClientInfo left, ClientInfo right)
        {
            return !left.Equals(right);
        }

        public void SetNull()
        {
            this.clientMessageID = 0;
            this.clientID = 0;
            this.clientName = null;
            this.clientIP = null;
            this.systemCode = null;
            this.clientRole = null;
            this.clientGroup = null;
            this.clientDept = null;
        }

        public string ToShortString()
        {
            return (this.clientMessageID.ToString() + "|" + this.clientName);
        }

        public override string ToString()
        {
            return (this.clientMessageID.ToString() + "|" + this.clientIP + "|" + this.SystemCode + "|" + this.clientID.ToString() + "|" + this.clientName);
        }

        // Properties
        public string ClientDept
        {
            get
            {
                return this.clientDept;
            }
            set
            {
                this.clientDept = value;
            }
        }

        public string ClientGroup
        {
            get
            {
                return this.clientGroup;
            }
            set
            {
                this.clientGroup = value;
            }
        }

        public int ClientID
        {
            get
            {
                return this.clientID;
            }
            set
            {
                this.clientID = value;
            }
        }

        public string ClientIP
        {
            get
            {
                return this.clientIP;
            }
            set
            {
                this.clientIP = value;
            }
        }

        public int ClientMessageID
        {
            get
            {
                return this.clientMessageID;
            }
            set
            {
                this.clientMessageID = value;
            }
        }

        public string ClientName
        {
            get
            {
                return this.clientName;
            }
            set
            {
                this.clientName = value;
            }
        }

        public string ClientRole
        {
            get
            {
                return this.clientRole;
            }
            set
            {
                this.clientRole = value;
            }
        }

        public string SystemCode
        {
            get
            {
                return this.systemCode;
            }
            set
            {
                this.systemCode = value;
            }
        }
    }
}
